<%@ include file="/taglibs.jsp"%>
<%@ page
import="java.util.*,java.util.Iterator,com.stable.model.*,com.stable.dao.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        
        <div id="login_screen">
            <div class="wm_hide" id="login_error"></div> 
            <div align="center"><html:form
                    action="abwesenheit.do?method=AbwesenheitSpeichern" method="post">
                    <table class="wm_login" id="login_table" border="0"
                           cellspacing="0" cellpadding="0" width="600px">
                        <col width="250"></col>
                        <col width="88"></col>
                        <col width="70"></col>
                        <col width="33"></col>
                        <col width="42"></col>
                        <tr>
                            <br/>
                            <br/>
                            <br/>
                            <br />
                            <td class="wm_login_header" colspan="5">Neue Abwesenheit anlegen</td>
                        </tr>
                        <tr>
                            <td  colspan="5" >
                                <html:messages id="message"property="absencerequired" message="true">
                                    <font color="red">    ${message} </font>
                                </html:messages>
                            </td>  
                        </tr>
                        <tr>
                            <td  colspan="5" >
                                <html:messages id="message" property="absencesave" message="true">
                                    <font color="green">    ${message} </font>
                                </html:messages>
                            </td>  
                        </tr>
                        <tr>
                            <td colspan="5">
                                <html:messages id="message"  property="dateisnotguilty" message="true">
                                    <font color="red">    ${message} </font>
                                </html:messages>
                            </td>  
                        </tr>                        
                        <tr>
                            <td class="wm_title"  style="text-align: right">Mitarbeiter</td>
                            
                            <td colspan="4" style="text-align: left">
                                <%
                                Integer userId = (Integer) session.getAttribute("userId");
                                
                                TblMitarbeiter mitarb = (TblMitarbeiter) new Dao().get(
                                        TblMitarbeiter.class, userId);
                                
                                TblRolle rolle = (TblRolle) new Dao().get(TblRolle.class, mitarb
                                        .getRolleId());
                               
                                if (rolle.getBez().equals("Administrator")) {
                                    List alleMitarb = new Dao()
                                    .findAllNotDelete("from TblMitarbeiter");
                                    if (alleMitarb != null) {                                       
                                %> <html:select property="mitarbeiterId" size="1"
                                                onfocus="this.className = 'wm_input_focus';"
                                                onblur="this.className = 'wm_input';">
                                    <%
                                    for (Iterator iterator = alleMitarb.iterator(); iterator
                                                .hasNext();) {
                                            TblMitarbeiter mita = (TblMitarbeiter) iterator.next();
                                    %>
                                    <html:option value="<%=String.valueOf(mita.getMitarbeiterId())%>">
                                        <%=mita.getVorname()%>
                                        <%=mita.getName()%>
                                    </html:option>
                                    
                                    
                                    <%
                                    }
                                    %>
                                </html:select> <%
                                    }
                                } else {
                                %> <%=mitarb.getVorname()%> <%=mitarb.getName()%>
                                <input type="hidden"  name="mitarbeiterId" value="<%=mitarb.getMitarbeiterId()%>">
                               <%
                                }
                                %>
                            </td>
                        </tr>
                       
                            <tr>
                                <td class="wm_title" style="text-align: right !important">Abwesenheitsart*</td>
                                <td colspan="4">
                                    <%
                                    List alleAbwart = new Dao().findAllNotDelete("from TblAbwart");
                                    
                                    if (alleAbwart != null) {
                                    %> <html:select property="abwartId" size="1"
                                                    onfocus="this.className = 'wm_input_focus';"
                                                    onblur="this.className = 'wm_input';" onchange="getKunde(this)">
                                        <html:option value="nichts">
                                            Bitte wählen Sie
                                        </html:option>
                                        <%
                                        for (Iterator iterator = alleAbwart.iterator(); iterator
                                                .hasNext();) {
                                            TblAbwart abwart = (TblAbwart) iterator.next();
                                        %>
                                        <html:option value="<%=String.valueOf(abwart.getAbwartId())%>">
                                            <%=abwart.getAbwart()%>
                                        </html:option>
                                        
                                        
                                        <%
                                        }
                                        %>
                                    </html:select> <%
                                    }
                                    %>
                                    <div class="kunde" id="kunde"></div>	
                                </td>
                                
                           
                               
    
                        </tr>      
                
                        <tr>
                            <td class="wm_title">Beginndatum</td>
                  			<td colspan="4" style="text-align: right"><input
				onfocus="this.className = 'wm_input_focus';"
				onblur="this.className = 'wm_input';" class="wm_input" type="text"
				size="8" name="theDate3"
				onclick="displayCalendar(document.forms[0].theDate3,'dd.mm.yyyy',this,true)"></td>
                        </tr>
                        <tr>
                            <tr>
                                <td class="wm_title">Endedatum</td>
                     			<td colspan="4" style="text-align: right"><input
				onfocus="this.className = 'wm_input_focus';"
				onblur="this.className = 'wm_input';" class="wm_input" type="text"
				size="8" name="theDate4"
				onclick="displayCalendar(document.forms[0].theDate4,'dd.mm.yyyy',this,true)">
                            </tr>
                            <tr>
                                <td class="wm_title">Zeitraum</td>
                                <td colspan="4" style="text-align: left"><input
				onfocus="this.className = 'wm_input_focus';"
				onblur="this.className = 'wm_input';" class="wm_input" type="checkbox"
				size="8" 
				onclick="getTimebox(this)">
                                <div class="timebox" id="timebox"></div>
                            </td>
                                 
                            </tr>                        
                        <tr>
                            <td class="wm_title" width="299" style="text-align: right !important">Beschreibung</td>
                            
                            <td colspan="4" style="text-align: right"><textarea
                                    class="wm_input"   id="beschreibung"
                                    name="beschreibung" maxlength="255"
                                    onfocus="this.className = 'wm_input_focus';"
                                onblur="this.className = 'wm_input';" ></textarea></td>
                        </tr>
                        <tr>
                            <td colspan="5" style="text-align: right"><span
                                    class="wm_login_button"> <input class="wm_button"
                                                            type="submit" value="Speichern" /> </span></td>
                        </tr>
                    </table>
            </html:form></div>
            
        </div>
        
        
        
        
    </body>
</html>



